package com.example.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.common.result.Result;
import com.example.entity.yifei.Cmsmd;
import com.example.mapper.CmsmdMapper;
import com.example.untils.StringUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lan
 * @since 2024-07-10
 */
@RestController
@RequestMapping("/api/cmsmd")
public class CmsmdController {

    @Resource
    private CmsmdMapper cmsmdMapper;

    @ApiOperation("查询工作中心")
    @GetMapping("/queryList")
    public Result<List<Cmsmd>> queryList(String code){
        QueryWrapper<Cmsmd> cmsmdQueryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(code)){
            cmsmdQueryWrapper.like("MD001", code).or().eq("MD002", code);
        }
        List<Cmsmd> cmsmdList = this.cmsmdMapper.selectList(cmsmdQueryWrapper);
        return Result.success(cmsmdList);
    }

}
